package com.ftg.rbac.service.impl;

import com.ftg.rbac.entity.Dept;
import com.ftg.rbac.mapper.DeptMapper;
import com.ftg.rbac.service.IDept;
import com.ftg.rbac.util.BaseResultSet;
import com.ftg.rbac.util.MybatisUtil;
import com.ftg.rbac.util.TreeUtil;
import com.ftg.rbac.vo.DeptTreeVo;

import java.util.List;

/**
 * 部门业务处理实现类
 *
 * @author kangjx
 * @version 1.0
 * @date 2023/3/16 上午9:12
 */
public class DeptImpl implements IDept {

    DeptMapper deptMapper = MybatisUtil.getInstance(DeptMapper.class);

    @Override
    public BaseResultSet showDeptTree() {
        BaseResultSet brs = new BaseResultSet();
        List<Dept> list = deptMapper.list();
        brs.setCode(200);
        brs.setMess("树形生成成功");
        brs.setData(TreeUtil.createTree(DeptTreeVo.class,list));
        return brs;
    }
}
